<?php

class EmbeddedPhoneNumberForm extends PhoneNumberForm {
	
	public function configure() {
		parent::configure();
		
		unset($this['member_list']);
		
		$this->validatorSchema['area_code']->setOption('required', false);
		$this->validatorSchema['call_through']->setOption('required', false);
		$this->validatorSchema['country_id']->setOption('required', false); // workaround for not getting a 'required' comment after pressing the add button
		
		// set labels
		$this->widgetSchema->setLabels(array(
			'dialing_code' => 'Vorwahl',
			'call_through' => 'Ortsanschluss',
			'country_id' => 'Land',
			'type' => 'Typ'
		));
	}
	
	public static function formValuesAreBlank(array $values) {
		$fieldNames = array_diff(PhoneNumberTable::getInstance()->getFieldNames(),
						array('id',
							'created_at', 'updated_at', 'deleted_at',
							'created_by', 'updated_by', 'deleted_by'));
		$fieldNames = array(
			'area_code', 'call_through');
		return parent::__formValuesAreBlank($fieldNames, $values);
	}
}